import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

/// <summary>
/// todo: 系统相关设置
/// author：zwb
/// dateTime： 2021/11/3 11:46
/// filePath： lib/constant/system.dart
/// desc:
/// <summary>
///
class System{

  /// todo：设置竖屏
  static Future<void> setHorizontalScreen(){
    return SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown
    ]);
  }

  /// todo：设置横屏
  static Future<void>  setVerticalScreen(){
    return SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeLeft,
      DeviceOrientation.landscapeRight
    ]);
  }

  /// todo： 状态栏 暗色
  static uiDark() =>  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);

  /// todo： 状态栏 亮色
  static uiLight() =>  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);

  /// todo： 隐藏 状态栏 底部按钮栏
  static hideTopBottom() async => await  SystemChrome.setEnabledSystemUIOverlays ([]);

  /// todo： 隐藏 状态栏 底部按钮栏
  static hideTop() async => await SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.bottom]);

  /// todo： 隐藏底部按钮栏
  static hideBottom()  async => await  SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.top]);

  /// todo： 显示 状态栏 底部按钮栏
  static showTopBottom()  async => await  SystemChrome.setEnabledSystemUIOverlays (SystemUiOverlay.values);

  /// todo： 沉浸式
  static immersive() async => SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.transparent,statusBarIconBrightness: Brightness.dark),);

}